home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-18 | 4.6 KB | 163 lines | [TEXT/CWIE] |
- //========================================================================================
- //
- // File: MacHackView.cpp
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef MACHACKVIEW_H
- #include "MacHackView.h"
- #endif
-
- #ifndef MACHACKVIEW_H
- #include "MacHackView.h"
- #endif
-
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef DEFINES_K
- #include "Defines.k"
- #endif
-
- // ----- Framework Layer -----
-
- #ifndef FWFRAME_H
- #include "FWFrame.h"
- #endif
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWEVEDEF_H
- #include "FWEveDef.h"
- #endif
-
- #ifndef FWPRESEN_H
- #include "FWPresen.h"
- #endif
-
- #ifndef FWSCROLR_H
- #include "FWScrolr.h"
- #endif
-
- #ifndef FWSCLBAR_H
- #include "FWSclBar.h"
- #endif
-
- #ifndef FWGROWBX_H
- #include "FWGrowBx.h"
- #endif
-
- #ifndef FWCONTXT_H
- #include "FWContxt.h"
- #endif
-
- //========================================================================================
- // Runtime Information
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfcontainer
- #endif
-
- //========================================================================================
- // CMacHackView
- //========================================================================================
-
- FW_DEFINE_CLASS_M1(CMacHackView, FW_CSuperView)
- FW_DEFINE_AUTO(CMacHackView)
-
- // IMPORTANT: the constant below must match the resource label for RMacHackView in views.fr
- const FW_ClassTypeConstant LMacHackView = FW_TYPE_CONSTANT('m','h','v','w');
- FW_REGISTER_ARCHIVABLE_CLASS(LMacHackView, CMacHackView, CMacHackView::Create, FW_CView::Read, CMacHackView::Destroy, FW_CView::Write)
-
- //----------------------------------------------------------------------------------------
- // CMacHackView::CMacHackView
- //----------------------------------------------------------------------------------------
-
- CMacHackView::CMacHackView(Environment* ev) :
- FW_CSuperView(ev),
- fMacHackPart(NULL)
- {
- FW_DO_NOT_DEAD_STRIP(CMacHackView);
- FW_DO_NOT_DEAD_STRIP(FW_CScrollBar);
- FW_DO_NOT_DEAD_STRIP(FW_CScrollBarScroller);
- FW_DO_NOT_DEAD_STRIP(FW_CGrowBox);
- FW_DO_NOT_DEAD_STRIP(FW_CButton);
-
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CMacHackView::~CMacHackView
- //----------------------------------------------------------------------------------------
-
- CMacHackView::~CMacHackView()
- {
- FW_START_DESTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CMacHackView::PostCreateViewFromStream
- //----------------------------------------------------------------------------------------
-
- void CMacHackView::PostCreateViewFromStream(Environment* ev)
- {
- // Read-in the base resource first
- FW_CSuperView::PostCreateViewFromStream(ev);
-
- FW_CPart* part = GetFrame(ev)->GetPart(ev);
- fMacHackPart = FW_DYNAMIC_CAST(CMacHackPart, part);
- FW_ASSERT(fMacHackPart != NULL);
- }
-
- //----------------------------------------------------------------------------------------
- // CMacHackView::Draw
- //----------------------------------------------------------------------------------------
-
- void CMacHackView::Draw(Environment* ev, ODFacet* odFacet, ODShape* invalidShape)
- {
- FW_CViewContext vc(ev, this, odFacet, invalidShape);
-
- FW_CRect invalidRect;
- vc.GetClipRect(invalidRect);
- FW_CRectShape::RenderRect(vc, invalidRect, FW_kFill, FW_kRGBLightGray);
-
- FW_CRect extentRect(FW_kZeroPoint, GetExtent(ev));
- invalidRect.Intersection(extentRect);
- FW_CRectShape::RenderRect(vc, invalidRect, FW_kFill, FW_CColor(56000, 56000, 65535));
-
- extentRect.Inset(FW_kFixedNeg1, FW_kFixedNeg1);
- FW_CRectShape::RenderRect(vc, extentRect, FW_kFrame);
- }
-
- //----------------------------------------------------------------------------------------
- // CMacHackView::Create
- //----------------------------------------------------------------------------------------
-
- void* CMacHackView::Create(FW_CReadableStream& stream, FW_ClassTypeConstant type)
- {
- FW_UNUSED(stream);
- FW_UNUSED(type);
- FW_SOMEnvironment ev;
-
- // Call minimal constructor. Data fields will be initialized in InitializeFromStream
- return FW_NEW(CMacHackView, (ev));
- }
-
- //----------------------------------------------------------------------------------------
- // CMacHackView::Destroy
- //----------------------------------------------------------------------------------------
-
- void CMacHackView::Destroy(void* object, FW_ClassTypeConstant type)
- {
- FW_UNUSED(type);
- CMacHackView* self = (CMacHackView*) object;
- delete self;
- }
-